/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ticketonline.ui.servlet;

import java.io.IOException;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
import ticketonline.entity.Customer;
import ticketonline.service.AppService;

/**
 *
 * @author amir
 */
public class DeleteCustomer extends HttpServlet{
    
    private AppService service;
    
    @Override
    public void init(ServletConfig config) throws ServletException {
        ApplicationContext ctx = WebApplicationContextUtils
        .getWebApplicationContext(config.getServletContext());

        service = (AppService) ctx.getBean("appService");
    }

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Customer c = new Customer();
        c.setCustID(1);
        service.deleteCustomer(c);
        resp.sendRedirect("daftar.dot");
        
        
    }
    
    
    
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Customer c = new Customer();
        //c.setCustID(1);
        
        service.deleteCustomer(c);
        resp.sendRedirect("daftar.dot");
    }
    
}
